<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>proxy</title>
</head>
<body>
  hello,world
  <input type="text" id="model">
  <p id="word"></p>
</body>
<script>
  let model = document.getElementById('model');
  let word = document.getElementById('word');
  let obj = {};
  let newObj = new Proxy(obj,{
    get(target,key,receiver){
       console.log('get key');
       return Reflect.get(target,key,receiver)
    },
    set(target,key,value,receiver){
      console.log('setting',target,key,receiver);
      if(key === 'text'){
         model.value = value;
         word.innerHTML = value;
      }
      return Reflect.set(target,key,value,receiver);
    }
  });
  model.addEventListener("keyup",function(e){
    newObj.text = e.target.value;
    console.log(newObj.text);
  })
</script>
</html>